package com.zhunaer.service.impl;

import com.zhunaer.dao.ShopDao;
import com.zhunaer.dao.impl.ShopDaoImpl;
import com.zhunaer.entity.Shop;
import com.zhunaer.service.ShopService;
import java.util.List;

public class ShopServiceImpl implements ShopService {
    private final ShopDao shopDao = new ShopDaoImpl();

    @Override
    public boolean applyShop(Shop shop) {
        return shopDao.insert(shop) > 0;
    }

    @Override
    public boolean updateShopInfo(Shop shop) {
        return shopDao.update(shop) > 0;
    }

    @Override
    public List<Shop> getShopByUserId(Integer userId) {
        return shopDao.findByUserId(userId);
    }

    @Override
    public List<Shop> getAllShops() {
        return shopDao.findAll();
    }

    @Override
    public Shop getShopById(Integer shopId) {
        return shopDao.findById(shopId);
    }

    @Override
    public boolean auditShop(Integer shopId, Integer auditStatus) {
        return shopDao.updateAuditStatus(shopId, auditStatus) > 0;
    }

    @Override
    public List<Shop> findShopsByCondition(String keyword, String status) {
        return shopDao.findByCondition(keyword, status);
    }
}